<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <title>重置密码</title>
  {% include 'rbac/common/add-edit-header.html' %}
</head>
<body>

<form class="layui-form" id="reset-pwd-from" lay-filter="reset-pwd-from">
  <div class="layui-form-item">
    <div class="layui-inline">
      <label class="layui-form-label">新密码</label>
      <div class="layui-input-inline layui-input-wrap">
        <input type="password" name="password" lay-verify="required|password" autocomplete="off"
               lay-affix="eye" class="layui-input">
      </div>
    </div>
  </div>
  <div class="layui-form-item">
    <div class="layui-inline">
      <label class="layui-form-label">再输入密码</label>
      <div class="layui-input-inline layui-input-wrap">
        <input type="password" name="repassword" lay-verify="required|password" autocomplete="off"
               lay-affix="eye" class="layui-input">
      </div>
    </div>
  </div>
  <div class="layui-form-item">
    <div class="layui-input-block">
      <button type="submit" class="layui-btn" lay-submit lay-filter="reset-pwd-from-btn">立即提交</button>
      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </div>
  </div>
</form>

{% include 'rbac/common/add-edit-footer.html' %}
<script>
  let token = "{{ csrf_token }}";
  solve_csrf(token)

  layui.use(["tree", "table", "form", "popup", 'util'], function () {
    let popup = layui.popup;
    let form = layui.form;

    // 更新当前角色的所拥有的权限!!
    form.on("submit(reset-pwd-from-btn)", function (data) {
      let url = "/api/v1/user/reset_pwd/"
      let d = {...data.field, user_id: {{user_obj.id}}} // 授哪些权,给哪个角色授权
      let reload_table = ""  // 重置密码成功后没必要刷新表格
      addAndEditAjaxRequest(popup, url, d, reload_table)
      return false;
    });
  });


</script>

</body>
</html>